package com.gitee.swsk33.catservice.api;

import com.gitee.swsk33.catentity.dataobject.Cat;
import com.gitee.swsk33.catentity.model.Result;
import com.gitee.swsk33.catservice.service.CatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/cat")
public class CatAPI {

	@Autowired
	private CatService catService;

	@GetMapping("/get/{id}")
	public Result<Cat> getById(@PathVariable("id") int id) {
		return catService.getById(id);
	}

	@GetMapping("/get-all")
	public Result<List<Cat>> getAll() {
		return catService.getAll();
	}

}